package zb.thr3;

import com.sun.jdi.event.ExceptionEvent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author wzby
 * @Date: 2022/8/8 19:54
 */
public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
       T1 t1 = new T1(5);
        FutureTask<Integer> f1 = new FutureTask<>(t1);
        Thread tf1 = new Thread(f1);
        tf1.start();
        System.out.println(f1.get());

        T1 t2 = new T1();
        FutureTask<Integer> f2 = new FutureTask<>(t2);
        Thread tf2 = new Thread(f2);
        tf2.start();
        System.out.println(f2.get());
    }
}
